package acwing_04;
import java.io.*;
import java.util.*;
public class _869_试除法求约数 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		int n = Integer.parseInt(br.readLine());
		int num;
		List<Integer> list;
		while(n-- > 0) {
			list = new ArrayList<Integer>();
			num = Integer.parseInt(br.readLine());
			for(int i = 1; i <= num / i ; i++) {
				// 能被i整除且没有余数，则i是num的约数
				if(num % i == 0) {
					list.add(i);
					// 既然i是约数，那么能被num/i得到的值也是约数
					// 如果num是i的平方，即i == num / i，那么会跟上面list.add的值相同，所以要进行判断
					if(i != num / i) {
						list.add(num / i);
					}
				}
			}
			Collections.sort(list);
			for (Integer integer : list) {
				bw.write(integer + " ");
			}
			bw.newLine();
		}
		
		bw.flush();
		
	}
}
